﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using ExpertStockSystem.Models;
using ExpertStockSystem.DAL;

namespace ExpertStockSystem
{
    /// <summary>
    /// Interaction logic for WarehouseItemUserControl.xaml
    /// </summary>
    public partial class WarehouseItemUserControl : UserControl
    {
        public WarehouseSpace warehouseSpace = null;
        public int row;
        public int column;
        private WarehouseRepository warehouseRepository = new WarehouseRepository();

        public WarehouseItemUserControl(WarehouseSpace _warehouseSpace,int _row,int _column)
        {
            InitializeComponent();
            row = _row;
            column = _column;
            warehouseSpace = _warehouseSpace;
        }

        private void UserControl_MouseEnter(object sender, MouseEventArgs e)
        {
            this.Background = Brushes.LightGray;
        }

        private void UserControl_MouseLeave(object sender, MouseEventArgs e)
        {
            this.Background = Brushes.DarkGray;
        }

        private void UserControl_MouseDown(object sender, MouseButtonEventArgs e)
        {
            if (warehouseSpace != null)
            {
                warehouseRepository.AddWarehouseSpace(row, column);
                MessageBox.Show("This space has been enabled");
            }
        }
    }
}
